#include "GeodeSphereOsg.h"
#include <Functions.h>
GeodeSphereOsg::GeodeSphereOsg(QObject *parent)
{
    m_object = new SphereGeode();
    this->refreshInfoContainer();

    osg::Node* nodePtr = dynamic_cast<osg::Node*>(m_object.get());
    nodePtr->setNodeMask(0xfffffffe);

}

GeodeSphereOsg::~GeodeSphereOsg()
{

}

double GeodeSphereOsg::getRadius()
{
    double result = -1;
    SphereGeode* point3DPtr = dynamic_cast<SphereGeode*>(m_object.get());
    if(point3DPtr != NULL)
    {
        result = point3DPtr->getRadius();
    }
    return result;
}

double GeodeSphereOsg::getFineness()
{
    double result = -1;
    SphereGeode* point3DPtr = dynamic_cast<SphereGeode*>(m_object.get());
    if(point3DPtr != NULL)
    {
        result = point3DPtr->getFineness();
    }
    return result;
}

void GeodeSphereOsg::setRadius(double radius)
{
    if( EEditorFunctions::doubleEqual(getRadius(), radius) || radius < 0 )
    {
        return;
    }

    SphereGeode* point3DPtr = dynamic_cast<SphereGeode*>(m_object.get());
    if(point3DPtr != NULL)
    {
        point3DPtr->setRadius(radius);
    }

}

void GeodeSphereOsg::setFineness(double fineness)
{
    if( EEditorFunctions::doubleEqual(getFineness(), fineness) || fineness < 0 )
    {
        return;
    }

    SphereGeode* point3DPtr = dynamic_cast<SphereGeode*>(m_object.get());
    if(point3DPtr != NULL)
    {
        point3DPtr->setFineness(fineness);
    }
}
